package com.zbkj.client.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

/**
 * 客户端安全配置属性
 * +----------------------------------------------------------------------
 * | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
 * +----------------------------------------------------------------------
 * | Author: CRMEB Team <admin@crmeb.com>
 * +----------------------------------------------------------------------
 */
@Component
@ConfigurationProperties(prefix = "crmeb.client.security")
public class ClientSecurityProperties {

    /**
     * 不需要token验证的路径
     */
    private List<String> excludePaths = Arrays.asList(
        // 登录相关接口
        "/api/client/login",
        "/api/client/sendCode",
        // 测试接口
        "/api/client/test/public",
        // Swagger相关
        "/swagger-ui",
        "/swagger-resources",
        "/v2/api-docs",
        "/webjars",
        // 静态资源
        "/static",
        "/public",
        // 健康检查
        "/actuator",
        // Druid监控
        "/druid",
        // 错误页面
        "/error",

        //websocket相关连接
        "/ws",

        //数字人回调地址
        "/dp/**",

        //防盗链接口
        "/api/client/common/proxyImage",

        //SSE连接
        "/api/client/sse/**",
        "/api/client/index/**",

        //python调用，写入agent和group
        "/dr/**",

        //套餐接口
        "/api/client/package/getConfigDetail",
        "/api/client/package/getConfigList",

        //发现详情接口，agent详情接口，group详情接口，分享使用，去掉鉴权
        "/api/client/discovery/getDetail",
        "/api/client/agent/getAgentInfo",
        "/api/client/agent/getGroupInfo"

    );

    /**
     * token过期时间（分钟）
     */
    private int tokenExpireMinutes = 30;

    /**
     * 是否启用JWT过滤器
     */
    private boolean enableJwtFilter = true;

    public List<String> getExcludePaths() {
        return excludePaths;
    }

    public void setExcludePaths(List<String> excludePaths) {
        this.excludePaths = excludePaths;
    }

    public int getTokenExpireMinutes() {
        return tokenExpireMinutes;
    }

    public void setTokenExpireMinutes(int tokenExpireMinutes) {
        this.tokenExpireMinutes = tokenExpireMinutes;
    }

    public boolean isEnableJwtFilter() {
        return enableJwtFilter;
    }

    public void setEnableJwtFilter(boolean enableJwtFilter) {
        this.enableJwtFilter = enableJwtFilter;
    }
} 